﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorSeaBeam.h
 * @brief  VAOne读写SEA梁适配器
 * 
 * @author lixiaolong (lixiaolong@diso.cn)
 * @date   2024-11-12
 *********************************************************************/
#ifndef VAONEXMLADAPTORSEABEAM_H
#define VAONEXMLADAPTORSEABEAM_H

#include "FITKVAOneXMLIOAPI.h"
#include "FITKAbstractVAOneXMLAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"

namespace Acoustics
{
    class FITKAcousticsSEASubSysManager;
    class FITKAbstractSEASubSys;
    class FITKSEASubSysBeam;
}

namespace IO
{
    /**
     * @brief   VAOne读写板适配器
     * @author  lixiaolong (lixiaolong@diso.cn)
     * @data    2024-11-7
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorSeaBeam : public FITKAbstractVAOneXMLAdaptor
    {
        FITKCLASS(IO, VAOneXMLAdaptorSeaBeam);
    public:

        /**
         * @brief   构造函数
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @data    2024-11-7
         */
        explicit VAOneXMLAdaptorSeaBeam()= default;

        /**
         * @brief   析构函数
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @data    2024-11-7
         */
        ~VAOneXMLAdaptorSeaBeam() = default;

        /**
         * @brief   适配器读数据
         * @return  是否执行成功
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        bool adaptR() override;

        /**
         * @brief   适配器写数据
         * @return  是否执行成功
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        bool adaptW() override;

    private:

        /**
         * @brief   读取物理属性数据
         * @param[i] node     xml节点数据
         * @param[o] data   板节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readPhyProperty(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysBeam *data);

        /**
         * @brief   读取损耗因子谱数据
         * @param[i] node     xml节点数据
         * @param[o] data   板节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readDamping(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysBeam *data);

        /**
         * @brief   读取弯曲波数据
         * @param[i] node     xml节点数据
         * @param[o] data   板节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readWave(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysBeam *data);

        /**
         * @brief   读取模态密度数据
         * @param[i] node     xml节点数据
         * @param[o] data   板节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readModelDensity(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysBeam *data);

        /**
         * @brief   读取单个单元数据
         * @param[i] node     xml节点数据
         * @param[o] data   板节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readCell(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysBeam *data);

        /**
         * @brief   写物理属性数据
         * @param[i] data   板节点数据
         * @param[o] node   xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writePhyProperty(Acoustics::FITKSEASubSysBeam *data, rapidxml::xml_node<char>* node);

        /**
         * @brief  写损耗因子谱数据
         * @param[i] data   板节点数据
         * @param[o] node   xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeDamping(Acoustics::FITKSEASubSysBeam *data, rapidxml::xml_node<char>* node);

        /**
         * @brief   写入波数据
         * @param[i] data   板节点数据
         * @param[o] node   xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeWave(Acoustics::FITKSEASubSysBeam *data, rapidxml::xml_node<char>* node);

        /**
         * @brief   写入模态密度数据
         * @param[i] data   板节点数据
         * @param[o] node     xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeModelDensity(Acoustics::FITKSEASubSysBeam *data, rapidxml::xml_node<char>* node);

        /**
         * @brief   写入单个单元数据
         * @param[i] data   板节点数据
         * @param[o] node    xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeCell(Acoustics::FITKSEASubSysBeam *data, rapidxml::xml_node<char>* node);

    private:
    };

    Register2FITKIOAdaptorFactory(VAOneXMLBeam, Acoustics::FITKAcousticsSEASubSysManager, VAOneXMLAdaptorSeaBeam)
}

#endif // VAONEXMLADAPTORSEABEAM_H
